package com.lvmama.pangolin.mt.service.impl;

import com.github.pagehelper.PageHelper;
import com.lvmama.pangolin.entity.InputCommodityVO;
import com.lvmama.pangolin.entity.mt.MTTicketCommodityItem;
import com.lvmama.pangolin.entity.mt.MTTicket_CommodityDetail;
import com.lvmama.pangolin.mt.service.MTTicketCommodityItemsService;
import com.lvmama.pangolin.mybatis.mapper.mt.MTTicketCommodityItemsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Transactional
@Service
public class MTTicketCommodityItemsServiceImpl implements MTTicketCommodityItemsService {
	/**  
	* @Title：TCCommodityItemsServiceImpl.java
	* @Author:zhoutianqi
	* @Description:
	* @Date：2017年3月6日下午4:33:17  
	*/
	@Autowired
	private MTTicketCommodityItemsMapper mtCommodityItemsMapper;
	public int insert(MTTicket_CommodityDetail item)throws Exception{
		return mtCommodityItemsMapper.insert(item);
	}
	public MTTicketCommodityItem selectById(String id,String productId)throws Exception{
		return mtCommodityItemsMapper.selectById(id,productId);
	}
	public int update(MTTicket_CommodityDetail item)throws Exception{
		return mtCommodityItemsMapper.update(item);
	}
	@Override
	public List<MTTicketCommodityItem> selectByProdId(String product_id) {
		return mtCommodityItemsMapper.selectByProdId(product_id);
	}
	@Override
	public MTTicketCommodityItem selectByProdCommId(String productId, String commodityId) {
		return mtCommodityItemsMapper.selectByProdCommId(productId, commodityId);
	}
	@Override
	public void updateByProdCommId(String productId, String commodityId) {
		mtCommodityItemsMapper.updateByProdCommId(productId, commodityId);
		
	}
	@Override
	public void deleteLinkByProdCommId(String productId, String commodityId) {
		mtCommodityItemsMapper.deleteLinkByProdCommId(productId, commodityId);
		
	}
	@Override
	public void updateSelective(MTTicketCommodityItem item) {
		mtCommodityItemsMapper.updateSelective(item);
		
	}
	@Override
	public void deleteById(String id) {
		mtCommodityItemsMapper.deleteById(id);
		
	}
	@Override
	public void insertSelective(MTTicketCommodityItem item) {
		mtCommodityItemsMapper.insertSelective(item);
		
	}
	@Override
	public List<MTTicketCommodityItem> selectByProdComName(String productId, String commodityName) {
		return mtCommodityItemsMapper.selectByProdComName(productId, commodityName);
	}
	@Override
	public List<MTTicketCommodityItem> selectByCommVO(InputCommodityVO co) {
		PageHelper.startPage(co.getPage(), co.getPageSize());
		return mtCommodityItemsMapper.selectByCommVO(co);
	}
	@Override
	public int updateByProdCommIdAndType(MTTicket_CommodityDetail item) throws Exception {
		return mtCommodityItemsMapper.updateByProdCommIdAndType(item);
	}
	@Override
	public List<MTTicketCommodityItem> getActiveCommodity(String productId) {
		return mtCommodityItemsMapper.getActiveCommodity(productId);
	}

	@Override
	public List<MTTicketCommodityItem> selectByProdidAndIsLinked(Map<String, String> map) {
		return mtCommodityItemsMapper.selectByProdidAndIsLinked(map);
	}
}
